<?
	class OrderBO extends BusinessObject
  {
	  var $STATUS_NEW              = 0;
	  var $STATUS_PAID             = 1;
	  var $STATUS_PARTIAL_REDEEMED = 2;
	  var $STATUS_REDEEMED         = 3;
	  var $STATUS_CANCELLED        = 4;
	  var $STATUS_AGENT_CREDIT     = 5;

	  function setAttributes()
      {
			//0 - New
			//1 - Paid
			//2 - Partial Redeemed
			//3 - Redeemed
			//4 - Cancelled
			$this->fields     = array
            (
				'id' 			=>	'ordID',
				'date'			=>  'ordDate',
				'user'			=>	'ordUser',
				'userName'		=>	'ordUserName',
				'email'			=>	'ordEmail',
				'CCNumber'		=>	'ordCCNumber',
				'CCNameOnCard'  =>	'ordCCNameOnCard',
				'CCType'		=>	'ordCCType',
				'CCExpireMonth'	=>	'ordCCExpireMonth',
				'CCExpireYear'	=>	'ordCCExpireYear',
				'CVV2'          =>	'ordCVV2',
				'total'			=>	'ordTotal',
            	'total_paid'	=>	'ordTotalPaid',
				'com_total'		=>	'ordComTotal',
				'status'		=>	'ordStatus',
				'displayed'		=>	'ordDisplayed',
				'deleted'		=>	'ordDeleted',
				'description'	=>	'ordDescription',
				'site'	        =>	'ordSite',
				'affiliate_id'  =>	'ordAffiliateID',
				'code'			=>	'ordCode',
				'provider'      =>  'ordProvider',
				'agentID'       =>  'ordAgentID',
        		'xml'           =>  'ordBankXML',
        		'inhome_agent'	=>	'ordInhomeAgent',
        		'region'        =>  'ordRegion',
            	'cash_deposit'        =>  'ordCashDeposit',
            	'commision_amount'    =>  'ordCommisionAmount',
            	'balance_due'         =>  'ordBalanceDue',
            	'cash_deposit_status' =>  'ordCashDepositStatus'
			);

		$u = new UserBO();
		$op = new OrderPartBO ();
		$aff = new AffiliateBO();
		$this->relations = array("{$u->tableName}" => "{$this->tableName}.{$this->fields['user']} = {$u->tableName}.{$u->fields['id']}",
		"{$op->tableName}" => "{$this->tableName}.{$this->fields['id']} = {$op->tableName}.{$op->fields['order']}",
		"{$aff->tableName}" => "{$this->tableName}.{$this->fields['affiliate_id']} = {$aff->tableName}.{$aff->fields['id']}",
		);

			BusinessObject::setAttributes();
		}
		/* constructor */
		function OrderBO (){
			BusinessObject::BusinessObject ("orders");
			 $this->setAttributes();
		}
	}
?>